package com.slz3.business.module.messageManagement.mesOrder.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesOrder.domain.MesOrder;
import com.slz3.business.module.messageManagement.mesOrder.domain.MesOrderFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesOrderTransactionalServiceImpl implements MesOrderTransactionalService {

    @Override
    public MesOrder modify(MesOrder mesOrderNew) {
        Repositorys.mesOrder.test();
        Repositorys.mesOrder.save(MesOrderFactory.initBaseFields());
        System.err.println(1/0);
        mesOrderNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesOrder.saveAndFlush(mesOrderNew);
    }

    @Override
    public List<MesOrder> batchModify(List<MesOrder> mesOrderList) {
        return Repositorys.mesOrder.saveAll(mesOrderList);
    }
}
